# -*- coding: utf-8 -*-
# @Time    : 2019/2/27 14:34
# @Author  : Macher
# @File    : bayes.py
# @Software: PyCharm Community Edition

ptest = 0.5
tp = 680
fn = 595
fp = 101
tn = 1949
count = 3325

def pba(a,b):

    # print float((a + b))/3325
    # print round((a + b)/3325,5)
    return float((a + b))/3325

def bayes(pt):
    tp = 680
    fn = 595
    fp = 101
    tn = 1949


    b1 = pba(tp,tn)
    b2 = pba(fp,fn)
    # print b1
    # print b2
    # s1 = float('%.2f' % pt * b1)
    s1 = pt * b1
    s2 =(pt * b1) + (1- pt) * b2
    s = s1 / s2
    print s
    bayes(s)

bayes(ptest)
# for i in range(0,10):
#     bayes()
# pba(680,1949)
# print 2629.0/3325